import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 38917
 * Date: 2025-02-11
 * Time: 02:05
 */
public class test {
    public static void main(String[] args) {
        BinaryTree binaryTree = new BinaryTree();
        BinaryTree.BTNode root = binaryTree.createBinaryTree();
        binaryTree.preOrder(root);
        System.out.println();
        binaryTree.preOrder2(root);
        System.out.println("----------------------------------------");
        binaryTree.inOrder(root);
        System.out.println();
        binaryTree.inOrder2(root);
        System.out.println("----------------------------------------");
        binaryTree.postOrder(root);
        System.out.println();
        binaryTree.postOrder2(root);
        System.out.println("----------------------------------------");
        System.out.println(binaryTree.size(root));
        System.out.println("----------------------------------------");
        System.out.println("叶子个数:" + binaryTree.getLeafNodeCount(root));
        System.out.println("----------------------------------------");
        System.out.println("第四层的节点个数:" + binaryTree.getKLevelNodeCount(root,4));
        System.out.println("----------------------------------------");
        System.out.println("二叉树的最大高度为:" + binaryTree.getHeight(root));
        System.out.println("----------------------------------------");
        System.out.println(binaryTree.findValue(root, 61));
        System.out.println("----------------------------------------");
        System.out.print("binaryTree.levelOrder = ");
        binaryTree.levelOrder(root);
        System.out.println();
        System.out.println("----------------------------------------");
        List<List<BinaryTree.BTNode>> lists = binaryTree.levelOrder2(root);
        System.out.println("binaryTree.levelOrder2 = ");
        for (int i = 0; i < lists.size(); i++) {
            List<BinaryTree.BTNode> list = lists.get(i);
            for (int j = 0; j < list.size(); j++) {
                System.out.print(list.get(j) + " ");
            }
            System.out.println();
        }
        System.out.println("----------------------------------------");
        System.out.println("binaryTree.isCompleteTree = " + binaryTree.isCompleteTree(root));
        System.out.println("----------------------------------------");
        System.out.println(binaryTree.tree2str(root));

    }
}
